package com.example.mapper;

import com.example.pojo.Payment;
import com.example.pojo.Plan;
import com.example.pojo.Production;
import com.example.pojo.Quality;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface PayMapper {

    Long count(String customername, String paymentstatus, String productName, String status, LocalDate begin, LocalDate end, LocalDate begin1, LocalDate end1);

    List<Payment> page(Integer start, Integer pageSize, String customername, String paymentstatus, String productName, String status, LocalDate begin, LocalDate end, LocalDate begin1, LocalDate end1);
@Insert("insert into payorder (customername,phone,orderdate,finishdate,paymentstatus,product_id,product_name,num,price,total,status) values" +
        " (#{customername},#{phone},#{orderdate},#{finishdate},#{paymentstatus},#{productID},#{productName},#{num},#{price},#{total},#{status})")
    void add(Payment payment);

    void delete(int[] id);
@Update("update payorder set status='已提交' where id=#{payid}")
    void update(Integer payid);
@Select("select product_name as name,num,price from payorder where id =#{payId}")
Production seletName(int payId);
@Update("update payorder set status=#{status} where id=#{id}")
    void updates(int id, String status);
@Select("select * from payorder where id=#{id}")
    Payment seletone(int id);
@Select("select * from payorder")
    List<Payment> geAll();

    List<Payment> page1(Integer start, Integer pageSize, String customername, String paymentstatus, String productName, String status, LocalDate begin, LocalDate end, LocalDate begin1, LocalDate end1);

    List<Payment> page2(Integer start, Integer pageSize, String customername, String paymentstatus, String productName, String status, LocalDate begin, LocalDate end, LocalDate begin1, LocalDate end1);
@Update("update payorder set rtime=#{now} where id=#{id}")
    void setaa(int id, LocalDate now);

    Long count2s(LocalDate date);

    List<Payment> page2s(Integer start, Integer pageSize, LocalDate date);
}
